<?php
class Fpt_Business_Subpage
{
    /**
     * Instance
     */
    protected static $instances = null;

    /**
     * Constructor of class
     */
    protected function  __construct()
    {

    }

    /**
     * Get singletom instance
     */
    public final static function getInstance($options=array())
    {
        //Check class name
        $className  = $options['adapter'] ;        

        //If empty className
        if ( empty($className) )
        {
            return Fpt_Server::setOutputData(-1, 'empty class name', null);
        }//end if

        //Switch to get classname
        switch ( strtolower($className) )
        {
            case 'mysql':
                $className = 'Fpt_Business_Subpage_Adapter_MySql';
                break;
            default:
                return false;
        }

        //Put to list
        if ( !isset(self::$instances[$className]) )
        {
            self::$instances[$className] = new $className();
        }//end if

        //Return object class
        return self::$instances[$className];
    }
}